/**
 * 路由配置常量 - 避免硬编码路径
 */
export const ROUTES = {
  // 公开路由
  LANDING: '/',
  LOGIN: '/login',
  SIGNUP: '/signup',

  // 受保护路由
  DASHBOARD: '/dashboard',
  PROFILE: '/profile',
  
  // 功能模块
  HOT: '/hot',
  SCHEDULER: '/scheduler',
  ANALYTICS: '/analytics',
  USERS: '/users',
  FILES: '/files',
  SEARCH: '/search',
  NOTIFICATIONS: '/notifications',
  
  // AI聊天
  CHAT: '/ai/chat',
  
  // 爬虫相关
  CRAWLER: '/crawler',
  CRAWLER_OVERVIEW: '/crawler/overview',
  CRAWLER_TASKS: '/crawler/tasks',
  CRAWLER_SCHEDULER: '/crawler/scheduler',
  CRAWLER_DATA: '/crawler/data',
  CRAWLER_CONFIG: '/crawler/config',
  CRAWLER_MONITOR: '/crawler/monitor',
  CRAWLER_LOGS: '/crawler/logs',
  
  // 管理员路由
  ADMIN: '/admin',
  ADMIN_DASHBOARD: '/admin/dashboard',
  ADMIN_USERS: '/admin/users',
  ADMIN_ROLES: '/admin/roles',
  ADMIN_PERMISSIONS: '/admin/permissions',
  ADMIN_CRAWLERS: '/admin/crawlers',
  ADMIN_SYSTEM: '/admin/system',
  
  // 演示路由
  UI_COMPONENTS: '/ui-components',
  MAGIC_BENTO: '/magic-bento',
  THEME_TEST: '/theme-test',
} as const;

/**
 * 需要管理员权限的路由
 */
export const ADMIN_ROUTES = [
  ROUTES.ADMIN,
  ROUTES.ADMIN_DASHBOARD,
  ROUTES.ADMIN_USERS,
  ROUTES.ADMIN_ROLES,
  ROUTES.ADMIN_PERMISSIONS,
  ROUTES.ADMIN_CRAWLERS,
  ROUTES.ADMIN_SYSTEM,
];

/**
 * 检查路由是否需要管理员权限
 */
export const requiresAdminPermission = (pathname: string): boolean => {
  return ADMIN_ROUTES.some(route => pathname.startsWith(route));
};